<?php

define ('MySQL_DB_HOST', 'mysql_host');
define ('MySQL_DB_USER', 'mysql_user');
define ('MySQL_DB_PASSWORD', 'mysql_password');
define ('MySQL_DB_NAME', 'Meine_Datenbank');

class MySQL {

    var $conn;
    var $db;
    var $query;

    function MySQL () {
        $this->conn = @mysql_connect (MySQL_DB_HOST, MySQL_DB_USER, MySQL_DB_PASSWORD);
        if ($this->conn) {
            $this->db = mysql_select_db (MySQL_DB_NAME);
        }
    }

    function sql ($statement) {
        if ($this->db) {
            $this->query = mysql_query ($statement, $this->conn);
        }
    }

    function result () {
        $temp = array ();
        if ($this->query) {
            while ($row = mysql_fetch_array ($this->query, MYSQL_ASSOC)) {
                $temp[] = $row;
            }
            mysql_free_result ($this->query);
        }
        return $temp;
    }

    function error () {
        return mysql_error ();
    }

}

?>
